package com.ggshily.game.model.ms3d
{
	import flash.utils.ByteArray;
	
	public class Ms3d_material
	{
		public var name : String;                             // (char[32])
		public var ambient : Array = new Array(4);            // (float[4])
		public var diffuse : Array = new Array(4);
		public var specular : Array = new Array(4);
		public var emissive : Array = new Array(4);
		public var shininess : Number;
		public var transparency : Number;
		public var mode : int;
		public var texture : String;                         // char(128)
		public var alphamap : String;	                       // char(128)
		
		public function Ms3d_material(bytes : ByteArray)
		{
			if(bytes)
			{
				name = bytes.readUTFBytes(32);
				for(var i : int = 0; i < 4; i++)
				{
					ambient[i] = bytes.readFloat();
				}
				for(i = 0; i < 4; i++)
				{
					diffuse[i] = bytes.readFloat();
				}
				for(i = 0; i < 4; i++)
				{
					specular[i] = bytes.readFloat();
				}
				for(i = 0; i < 4; i++)
				{
					emissive[i] = bytes.readFloat();
				}
				shininess = bytes.readFloat();
				transparency = bytes.readFloat();
				mode = bytes.readUnsignedByte();
				texture = bytes.readUTFBytes(128);
				alphamap = bytes.readUTFBytes(128);
			}
		}
	}
}